package com.ncr.travel.appmgr.model;

import com.ncr.travel.appmgr.model.shared.Category;
import com.ncr.travel.appmgr.model.shared.FontOptions;
import com.ncr.travel.appmgr.model.shared.Text;


/**
 * @author ng185038
 * 
 */
public abstract class TextJson extends ConfigurationJson implements Text {

	private Category category;
	private boolean multiLine;
	private FontOptions fontOptions;

	/* (non-Javadoc)
	 * @see com.ncr.travel.appmgr.model.Text#getCategory()
	 */
	@Override
	public Category getCategory() {
		return category;
	}

	/* (non-Javadoc)
	 * @see com.ncr.travel.appmgr.model.Text#setCategory(com.ncr.travel.appmgr.model.TextJson.Category)
	 */
	@Override
	public void setCategory(Category category) {
		this.category = category;
	}

	/* (non-Javadoc)
	 * @see com.ncr.travel.appmgr.model.Text#isMultiLine()
	 */
	@Override
	public boolean isMultiLine() {
		return multiLine;
	}

	/* (non-Javadoc)
	 * @see com.ncr.travel.appmgr.model.Text#setMultiLine(boolean)
	 */
	@Override
	public void setMultiLine(boolean multiLine) {
		this.multiLine = multiLine;
	}

	/* (non-Javadoc)
	 * @see com.ncr.travel.appmgr.model.Text#getFontOptions()
	 */
	@Override
	public FontOptions getFontOptions() {
		return fontOptions;
	}

	/* (non-Javadoc)
	 * @see com.ncr.travel.appmgr.model.Text#setFontOptions(com.ncr.travel.appmgr.model.FontOptions)
	 */
	@Override
	public void setFontOptions(FontOptions fontOptions) {
		this.fontOptions = fontOptions;
	}

	@Override
	public String createElementId() {
		return "" + super.getId();
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = super.hashCode();
		result = prime * result + ((category == null) ? 0 : category.hashCode());
		result = prime * result + ((fontOptions == null) ? 0 : fontOptions.hashCode());
		result = prime * result + (multiLine ? 1231 : 1237);
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (!super.equals(obj))
			return false;
		if (getClass() != obj.getClass())
			return false;
		TextJson other = (TextJson) obj;
		if (category != other.category)
			return false;
		if (fontOptions == null) {
			if (other.fontOptions != null)
				return false;
		} else if (!fontOptions.equals(other.fontOptions))
			return false;
		if (multiLine != other.multiLine)
			return false;
		return true;
	}

	@Override
	public String toString() {
		return "TextJson [category=" + category + ", multiLine=" + multiLine + ", fontOptions=" + fontOptions + ", getId()=" + getId() + ", getName()=" + getName() + "]";
	}

}
